/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.iss.examsys.view;

import com.iss.examsys.entity.StudentExamStatus;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Named;

/**
 *
 * @author Quek Ting Hong
 */
@ApplicationScoped
@Named
public class ExamStudentStatusView {
    private List<StudentExamStatus> studentStatusList = new ArrayList();

    public void add(StudentExamStatus status){
        if(!studentStatusList.contains(status)){
            studentStatusList.add(status);
        }
    }
    
    public void update(StudentExamStatus status){
        for(StudentExamStatus stauses:studentStatusList){
            if(stauses.getUserId().equalsIgnoreCase(status.getUserId()) &&
                stauses.getExamId()== status.getExamId()){
                stauses.setStudentStatus(status.getStudentStatus());
            }
        }
    }
    public List<StudentExamStatus> getStudentStatusList() {
        return studentStatusList;
    }

    public void setStudentStatusList(List<StudentExamStatus> studentStatusList) {
        this.studentStatusList = studentStatusList;
    }

    
    
}
